package ${table.packageNames.entity};

<#list table.importPackages.entity as pkg>
import ${pkg};
</#list>

/**
 * <p>
 * ${table.comment!}
 * </p>
 *
 * @author ${author}
 * @since ${date}
 */
<#if isEntityLomBokModel>
@Data
@NoArgsConstructor
@AllArgsConstructor
<#if isEntityBuilderModel>
@Accessors(chain = true)
</#if>
</#if>
<#if isMybatisPlus>
@TableName("${table.name}")
</#if>
public class ${table.entityName} implements Serializable {

<#if entitySerialVersionUID>
    private static final long serialVersionUID = 1L;
</#if>
<#-- ----------  BEGIN 字段循环遍历  ---------->
<#list table.fields as field>
    <#if field.keyFlag>
        <#assign keyPropertyName="${field.propertyName}"/>
    </#if>

    <#if field.comment!?length gt 0>
    /**
     * ${field.comment}
     */
    </#if>
    <#if isMybatisPlus>
        <#if field.keyFlag>
        <#-- 主键 -->
            <#if field.keyIdentityFlag>
    @TableId(value = "${field.column}", type = IdType.AUTO)
            <#else >
    @TableId("${field.column}")
            </#if>
        <#else>
    @TableField("${field.column}")
        </#if>
    </#if>
    private ${field.propertyType} ${field.propertyName};
</#list>
<#------------  END 字段循环遍历  ---------->

<#if !isEntityLomBokModel>
    <#list table.fields as field>
        <#if field.propertyType == "boolean">
            <#assign getprefix="is"/>
        <#else>
            <#assign getprefix="get"/>
        </#if>
    public ${field.propertyType} ${getprefix}${field.capitalName}() {
        return this.${field.propertyName};
    }

        <#if isEntityBuilderModel>
    public ${table.entityName} set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
        <#else>
    public void set${field.capitalName}(${field.propertyType} ${field.propertyName}) {
        </#if>
        this.${field.propertyName} = ${field.propertyName};
        <#if isEntityBuilderModel>
        return this;
        </#if>
    }
    </#list>
</#if>

<#if !isEntityLomBokModel>
    @Override
    public String toString() {
        return "${table.entityName}{" +
    <#list table.fields as field>
        <#if field_index==0>
            "${field.propertyName}=" + ${field.propertyName} +
        <#else>
            ", ${field.propertyName}=" + ${field.propertyName} +
        </#if>
    </#list>
        "}";
    }
</#if>
}
